//  Android Carpool System
//  2011-2011
//  Author: Jinhuan Wang
//  name: d2spost.java
//  description: passager post a request to server 
//$history: /carpool/scr/com/DataExange/p2sRequest.java$
package com.carpool.message;

import java.sql.Date;

import com.google.android.maps.GeoPoint;

class mGeoPoint {
	private int longitude;
	private int latitude;

	public mGeoPoint(int longitude, int latitude) {
		this.latitude = latitude;
		this.longitude = longitude;
	}

	public void setlongitude(int longitude) {
		this.longitude = longitude;
	}

	public int getlongitude() {
		return this.longitude;
	}

	public void setlatitude(int latitude) {
		this.latitude = latitude;
	}

	public int getlatitude() {
		return this.latitude;
	}
}

public class p2sRequest extends RequestMessage {

	private mGeoPoint startPoint;
	private mGeoPoint endPoint;
	private Date period;

	public void setStartPoint(GeoPoint startPoint) {
		if (this.startPoint == null) {
			this.startPoint = new mGeoPoint(startPoint.getLongitudeE6(),
					startPoint.getLatitudeE6());
		} else {
			this.startPoint.setlongitude(startPoint.getLongitudeE6());
			this.startPoint.setlatitude(startPoint.getLatitudeE6());
		}
	}

	public GeoPoint getStartPoint() {
		return new GeoPoint(this.startPoint.getlatitude(),
				this.startPoint.getlongitude());
	}

	public void setEndPoint(GeoPoint endPoint) {
		if (this.endPoint == null) {
			this.endPoint = new mGeoPoint(endPoint.getLongitudeE6(),
					endPoint.getLatitudeE6());
		} else {
			this.endPoint.setlongitude(endPoint.getLongitudeE6());
			this.endPoint.setlatitude(endPoint.getLatitudeE6());
		}

	}

	public GeoPoint getEndPoint() {
		return new GeoPoint(this.endPoint.getlatitude(),
				this.endPoint.getlongitude());
	}

	public Date getDate() {
		return this.period;
	}

	public void setDate(Date period) {
		this.period = period;
	}
}
